﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace VisualMusic
{
    /// <summary>
    /// SettingWindow.xaml 的交互逻辑
    /// </summary>
    public partial class SettingWindow : Window
    {
        private Setting setting;
        public SettingWindow(MainWindow mainWindow, Setting setting, int page = 0)
        {
            mainWindow.settingWindow = this;
            this.Loaded += (s, e) => { tabControl.SelectedIndex = page; };
            this.Closed += (s, e) => { mainWindow.settingWindow = null; };
            this.setting = setting;
            this.DataContext = setting;
            InitializeComponent();
            this.directionUpRb.Checked += (s, e) => { setting.Direction = VisualDirection.Up; };
            this.directionDownRb.Checked += (s, e) => { setting.Direction = VisualDirection.Down; };
            this.directionLeftRb.Checked += (s, e) => { setting.Direction = VisualDirection.Left; };
            this.directionRightRb.Checked += (s, e) => { setting.Direction = VisualDirection.Right; };
            this.centerXReset.Click += (s, e) => { this.centerXSd.Value = 0.5; };
            this.centerYReset.Click += (s, e) => { this.centerYSd.Value = 0.5; };
            this.okBtn.Click += (s, e) => { Close(); };
            this.dragRec.MouseLeftButtonDown += (o, e) => { DragMove(); };
        }
    }
}
